#ifndef ENERGYMARKETLOGGER_H_
#define ENERGYMARKETLOGGER_H_

#include <string>
#include <sstream>
#include <vector>

#include "Poco/Message.h"

// Forward decalrations (instant including h files)
namespace Poco{class Logger;};

// Application logger: class that handles all application logging.
// It is implemented as a singleton

class EnergyMarketLogger
{
private:
        enum ELogger
        {
                ELoggerFile             = 0,
                ELoggerConsole,

                ELoggersCount
        };

        EnergyMarketLogger(void);

public:
        ~EnergyMarketLogger(void);

        // The one and only application logger is accessible through this method
        static EnergyMarketLogger& Instance()
{
                // This is the instance.
                static EnergyMarketLogger instance;
                static bool firstCall = true;
                if (firstCall)
                {
                        firstCall = false;
                       // instance.Log("\n\nStarting new log session.");
                }

                // Return a reference to the instance.
                return instance;
        }

        // Write to log a STL string.
        void Log(const std::string& inLogString, Poco::Message::Priority inPriority = Poco::Message::PRIO_NOTICE);
        // Write to log a STL string stream.
        void Log(const std::ostringstream& inLogString, Poco::Message::Priority inPriority = Poco::Message::PRIO_NOTICE);

        void setLogLevel (int fileLevel, int consoleLevel);

private:
        // Holds pointers to all loggers
        std::vector<Poco::Logger*> mLoggers;
};

#endif /*ENERGYMARKETLOGGER_H_*/
